<?php
use OSS\OssClient;
use OSS\Core\OssException;
function classLoader($class)
{
    $path = str_replace('\\', DIRECTORY_SEPARATOR, $class);
    $file = __DIR__ . DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR . $path . '.php';
    if (file_exists($file)) {
        require_once $file;
    }
}
spl_autoload_register('classLoader');
$accessKeyId = accessKeyId;
$accessKeySecret = accessKeySecret;
$endpoint = endpoint;
try 
{
    $ossClient = new OssClient($accessKeyId, $accessKeySecret, $endpoint);
} 
catch (OssException $e) 
{
    print $e->getMessage();
}
function uploadObject($object,$filePath)
{
    global $ossClient;
    try{
        $ossClient->uploadFile(bucket, $object, $filePath);
    } catch(OssException $e) {
        printf(__FUNCTION__ . ": FAILED\n");
        printf($e->getMessage() . "\n");
        return;
    }
    return true;
}
function deleteObject($object)
{
    global $ossClient;
    try{
        $ossClient->deleteObject(bucket, $object);
    } catch(OssException $e) {
        printf(__FUNCTION__ . ": FAILED\n");
        printf($e->getMessage() . "\n");
        return;
    }
    return true;
}